import request from '@/utils/request.js'
const state = {
  saleList:[],
	goodData:{}
}
const mutations = {
  SET_SALELIST(state,saleList){
    state.saleList = saleList
  },
	SET_GOODDATA(state,goodData){
	  state.goodData = goodData
	}
}
const actions = {
  async getSaleList({commit}){
    const result = await request('/getIndexSale')
    commit('SET_SALELIST',result)
  },
	async getGoodData({commit}){
	  const result = await request('/getIndexGood')
	  commit('SET_GOODDATA',result)
	}
}
const getters = {
	Goods(state){
		return (state.saleList || []).data || {}
	}
	
}

export default {
  namespaced:true,
  state,
  mutations,
  actions,
  getters
}